<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Module: prefs</title>

<!--
    <script src="http://shjs.sourceforge.net/sh_main.min.js"> </script>
    <script src="http://shjs.sourceforge.net/lang/sh_javascript.min.js"> </script>
-->
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/node-dark.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">
    
    <h1 class="page-title">Module: prefs</h1>
    
    



<section>
    
<header>
    <h2>
    prefs
    </h2>
    
</header>  

<article>
    <div class="container-overview">
    
    
    
        
            <div class="description"><p>The <code>fwlib/prefs</code> module includes utility functions for working with 
Fireworks preferences files.  By storing your persistent data as JSON 
strings, these utility functions make it easy to save and retrieve
information for your commands across Fireworks sessions.</p></div>
        
        
        
<dl class="details">
    
        
	
	
	

	
	
	
	
	
	
	
	
	
	
	
	
	
	<dt class="tag-source">Source:</dt>
	<dd class="tag-source"><ul class="dummy"><li>lib/fwlib/prefs.js, line 5</li></ul></dd>
	
    
    
	
	
	
	
</dl>

        
        
    
    </div>
    
    
    
    
    
    
        <h3 class="subsection-title">Requires</h3>
        
        <ul>
            <li>module:dojo/json</li>
        </ul>
    
    
    
        <h3 class="subsection-title">Classes</h3>
        
        <dl>
            <dt><a href="module-prefs.PrefsStorage.html">PrefsStorage</a></dt>
            <dd></dd>
        </dl>
    
    
    
    
    
    
    
        <h3 class="subsection-title">Methods</h3>
        
        <dl>
            
<dt>
    <h4 class="name" id="get"><span class="type-signature">&lt;static> </span>get</h4>
    
    
</dt>
<dd>
    
    
    <div class="description">
        <p>Returns the value of a preference setting.  This function assumes that
any existing data in the preference is a JSON string, and it will return
the evaluated result of that JSON.  If the preference doesn't currently
exist, or its value throws an error when evaluated, an empty object will 
be returned.  </p>

<p>The <code>inName</code> parameter should be a globally unique name for the preference.
To avoid collisions, try using the name of your extension plus your 
initials, or a reverse domain name like <code>com.example.MyExtension</code>.</p>

<p>You can pass in an object as the optional second parameter to provide
default properties for the preference data.  The defaults will not 
override any existing properties on the saved preference data:</p>

<pre><code>var settings = prefs.get("MyPref", { foo: 42 });
alert(settings.foo); // 42
settings.foo = "bar";
prefs.set("MyPref", settings);
settings = prefs.get("MyPref", { foo: 42 });
alert(settings.foo); // "bar"
</code></pre>
    </div>
    
    
    
    
    
        <h5>Parameters:</h5>
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		<th>Argument</th>
		
		
		
		<th>Default</th>
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>inName</code></td>
            
            
            <td class="type">
            
                        String
                        
                    
            </td>
            
            
                <td class="attributes">
                
                    
                
                </td>
            
            
            
                <td class="default">
                
                </td>
            
            
            <td class="description last"><p>The name of the preference.</p></td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>inDefaults</code></td>
            
            
            <td class="type">
            
                        Object
                        
                    
            </td>
            
            
                <td class="attributes">
                
                    &lt;optional><br>
                
                    
                
                </td>
            
            
            
                <td class="default">
                
                    null
                
                </td>
            
            
            <td class="description last"><p>An optional object containing default 
properties that will be added to the stored preference data, if any.</p></td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
	
	
	

	
	
	
	
	
	
	
	
	
	
	
	
	
	<dt class="tag-source">Source:</dt>
	<dd class="tag-source"><ul class="dummy"><li>lib/fwlib/prefs.js, line 59</li></ul></dd>
	
    
    
	
	
	
	
</dl>

    
    
    
    
    
    
    <h5>Returns:</h5>
    
            
<div class="param-desc">
    <p>The evaluated JS value of the preference.</p>
</div>




<dl>
	<dt>
		Type
	</dt>
	<dd>
		
		<span class="param-type">Object</span> 
		
	</dd>
</dl>

        
    
    
</dd>

        
            
<dt>
    <h4 class="name" id="set"><span class="type-signature">&lt;static> </span>set</h4>
    
    
</dt>
<dd>
    
    
    <div class="description">
        <p>Stores some data in the Fireworks preferences file as a JSON string.  The
data passed in as <code>inPrefs</code> is automatically converted to JSON.</p>
    </div>
    
    
    
    
    
        <h5>Parameters:</h5>
        

<table class="params">
    <thead>
	<tr>
		
		<th>Name</th>
		
		
		<th>Type</th>
		
		
		
		
		
		<th class="last">Description</th>
	</tr>
	</thead>
	
	<tbody>
	
	
        <tr>
            
                <td class="name"><code>inName</code></td>
            
            
            <td class="type">
            
                        String
                        
                    
            </td>
            
            
            
            
            
            <td class="description last"><p>The name of the preference.</p></td>
        </tr>
	
	
	
        <tr>
            
                <td class="name"><code>inPrefs</code></td>
            
            
            <td class="type">
            
                        Object
                        
                    
            </td>
            
            
            
            
            
            <td class="description last"><p>The value of the preference.</p></td>
        </tr>
	
	
	</tbody>
</table>
    
    
    
<dl class="details">
    
        
	
	
	

	
	
	
	
	
	
	
	
	
	
	
	
	
	<dt class="tag-source">Source:</dt>
	<dd class="tag-source"><ul class="dummy"><li>lib/fwlib/prefs.js, line 98</li></ul></dd>
	
    
    
	
	
	
	
</dl>

    
    
    
    
    
    
    
    
</dd>

        </dl>
    
    
    
    
    
</article>

</section>  




</div>

<nav>
    <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-DomStorage.html">DomStorage</a></li><li><a href="module-files.html">files</a></li><li><a href="module-fonts.html">fonts</a></li><li><a href="module-layers.html">layers</a></li><li><a href="module-prefs.html">prefs</a></li><li><a href="module-underscore.html">underscore</a></li></ul><h3>Classes</h3><ul><li><a href="a321565296.html">DomStorage</a></li><li><a href="module-layers.Layer.html">Layer</a></li><li><a href="module-layers.LayerTree.html">LayerTree</a></li><li><a href="module-prefs.PrefsStorage.html">PrefsStorage</a></li><li><a href="_.html">_</a></li></ul>
</nav>

<br clear="both">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3</a> on Mon Jul 08 2013 09:13:10 GMT-0700 (PDT)
</footer>

<script> sh_highlightDocument(); </script>
</body>
</html>
